1. Field of the Invention
The present invention relates to a method and a device for drawing a figure of plane geometry such as a polygon and more particularly to a method of determining the inside of a figure of plane geometry to be drawn so as to perform graphical processing on the inside of the figure, e.g., fill the inside of the figure with a predetermined color, and a display control device such as a graphics accelerator board, for implementing the method.
2. Description of the Prior Art
A prior art drawing method implemented via software bears the burden of determining whether or not each pixel is located inside or within a figure of plane geometry having a contour, such as a polygon, and filling such a polygon region with a color.
Such a drawing software program is executed as follows:
(1) draw the contour of a figure of plane geometry PA1 (2) determine whether or not each dot on the screen is located within the figure PA1 (3) determine whether or not each dot or pixel should be drawn
In the case of drawing each dot or pixel on a computer screen, data including color information is the target of drawing processing.
Referring now to FIGS. 9a to 9c, they illustrate views showing such a prior art drawing method implemented via software as mentioned above. According to the method, for example, as shown in FIG. 9a, a representation of the contour of a polygon can be achieved by drawing the line segments connected between a vertex 1 and another vertex 2, between the vertex 2 and another vertex 3, between the vertex 3 and another vertex 4, between the vertex 4 and another vertex 5, between the vertex 5 and another vertex 6, and between the vertex 6 and the vertex 1, sequentially. Then, a point 444 located within the contour of the polygon is colored with a predetermined color, as shown in FIG. 9b. The filling-in operation for the point 444 is carried out while whether or not the point is located within each of line segments which form the contour of the polygon is determined. That is, the determination is carried out as follows; whether or not one point 444 is located within the line segment connected between the vertexes 1 and 2, whether or not the target point is located within the line segment connected between the vertexes 2 and 3, whether or not the point is located within the line segment connected between the vertexes 3 and 4, whether or not the point is located within the line segment connected between the vertexes 4 and 5, whether or not the point is located within the line segment connected between the vertexes 5 and 6, and whether or not the point is located within the line segment connected between the vertexes 6 and 1 are determined sequentially. Then, if it is determined that the point is inside the polygon, the point 444 is filled in with a predetermined color.
There can be provided a method of determining whether each dot is located inside or outside a figure of plane geometry, comprising steps of selecting x or y coordinates of two points A and B from data (e.g. x and y coordinates) showing line segments which construct the contour of the figure of plane geometry, determining whether or not x or y coordinate of each dot is between the x or y coordinates of the two points, assuming that the point can be within the polygon if the x or y coordinate of the dot is between the x or y coordinates of the two points, and repeating the above steps for two points of each of the remaining line segments until it is concluded that the dot is inside or outside the polygon. As a result, the solid figure which is filled in with a predetermined color can be obtained as shown in FIG. 9c.
Drawing data thus obtained by calculations using a CPU are written into a memory device 111, which will be referred to as a frame memory hereinafter, for storing graphics data of a two-dimensional array in synchronization with a write signal from a display controller 114, as shown in FIG. 10. The graphics data written into the frame memory 111 is converted into an RGB signal within the display controller 114. The converted RGB signal is delivered as a video signal to a display monitor 113 and is displayed as the figure of plane geometry on the screen of the monitor 113.
As previously explained, such a prior art drawing method needs a plurality of steps of drawing the contour of a graphic, determining whether or not each point or each pixel is located inside the contour of the graphic, filling the point with a predetermined color, and writing the data of each pixel into a frame memory. Therefore, a disadvantage is that it is difficult to increase the speed at which a display control device using the prior art drawing method draws a graphic.